package pro.cherish.knowledgedemoioc.controller;


import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import pro.cherish.knowledgedemoioc.thread.HiThreadHandler;

import java.util.concurrent.*;

/**
 * @author 创建人：cherish
 * @version 版本号：V1.0
 * <p>
 * ***************************修订记录************************************
 * 2019-09-28 cherish 创建该类功能。
 * **********************************************************************
 * </p>
 * @ClassName 类名：Tcontroller5
 * @Description 功能说明：
 * <p>
 * TODO
 * </p>
 * **********************************************************************
 * @date 创建日期： 2019-09-28 cherish
 */
@RestController
public class Tcontroller5 {
    @GetMapping("/t5")
    public void t1(String name, Integer age) throws ExecutionException, InterruptedException {
        System.out.println(name + " " + age);
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(4, 4, 200, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>(), Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
        HiThreadHandler instance = HiThreadHandler.getInstance();
        Future future = threadPoolExecutor.submit(instance);
        Object result = future.get();
        System.out.println(result);
    }
}
